import { Button } from "antd";
import { useNavigate } from "react-router-dom";
import "./index.scss";
import { useLogin } from "@/store/login.js";

const Login = () => {
  const { fetchGetRouteList, fetchTestTokenLogin } = useLogin();
  const navigate = useNavigate();
  const jumpToContent = async () => {
    //获取后端路由
    const res = await fetchGetRouteList();
    if (res && res.code === 200) {
      navigate("/home");
    }
  };
  const handleClick = async () => {
    await fetchTestTokenLogin();
  };
  return (
    <>
      <div className={"login-title"}>我是login页面</div>
      <Button onClick={jumpToContent}>跳转</Button>
      <div>
        <Button onClick={handleClick}>token无感刷新</Button>
      </div>
    </>
  );
};
export default Login;
